home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / h / ch.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-28  |  10.5 KB  |  234 lines

  1. #include <stdio.h>
  2.  
  3. /*
  4.  *      INFORMATION KEPT FOR ALL TABLES
  5.  */
  6. struct tb_struct
  7. {
  8.     char    *tb_name;           /* internal name of table               */
  9.     char    *tb_show;           /* displayable human-oriented string    */
  10.     char    *tb_file;           /* name of file containing table        */
  11.     FILE    *tb_fp;             /* stdio file pointer                   */
  12.     long     tb_pos;            /* position in file                     */
  13.     int         tb_flags;        /* various bits    (type of table, etc)    */
  14. };
  15. #define    TB_SRC    000007            /* Source of table data */
  16. #define    TB_FILE        000000        /* Read from file */
  17. #define    TB_DBM        000000        /* Read from DBM database */
  18. #define    TB_NS        000001        /* Read from Nameserver */
  19.  
  20. #define TB_TYPE        000030        /* what type of question to ask NS */
  21. #define TB_DOMAIN    000010        /* ask the nameserver for a domain */
  22. #define TB_CHANNEL    000020        /* ask the nameserver for a channel */
  23. /* fine PLACE_HOLDER    000040        /* Used to be TB_ROOT */
  24. #define TB_PARTIAL    000100    /* enable trying partial domain matches */
  25. #define TB_ABORT        000200 /* don't look at other domains upon NS timeout */
  26. #define TB_ROUTE        000400 /* enable routing via subdomain matches */
  27.  
  28. typedef struct tb_struct    Table;
  29.  
  30. Table *tb_nm2struct ();
  31.  
  32. /*****************************************************************/
  33. /*
  34.  *      STRUCTURE USED FOR CACHING  (Version 1, this may change)
  35.  */
  36.  
  37. struct cache
  38. {
  39.     char    *ca_hostid;     /* host identification */
  40.     int     ca_value;       /* its bad connection value */
  41.     time_t  ca_expire;      /* time at which to expire entry */
  42.     struct  cache *ca_next; /* the next dead host... or NULL */
  43. };
  44.  
  45. typedef struct cache    Cache;
  46.  
  47. /*****************************************************************/
  48. /*
  49.  *      STRUCTURE USED FOR ALIAS SOURCES
  50.  */
  51.  
  52. struct al_source
  53. {
  54.     int    al_flags;
  55.     Table    *al_table;
  56.     struct al_source *al_next;
  57. };
  58. /* For use with al_flags */
  59. #define    AL_TRUSTED    00001    /* this alias file is trustworthy */
  60. #define AL_NOBYPASS    00002    /* this alias file cannot be bypassed */
  61. #define AL_PUBLIC       00004   /* this alias file may be EXPN'd */
  62.  
  63. typedef struct al_source    Alias;
  64.  
  65. /* *****************************************************************
  66.  *
  67.  *      STRUCTURES WHICH DESCRIBE CHANNELS
  68.  *
  69.  *  Ch_struct (typedef Chan) contains all of the parametric information
  70.  *  about a channel.  There may be several telephone and/or pobox channels,
  71.  *  but each type is exec'd from a single executable file, so that the
  72.  *  structure provides distinguishing information.  For telephone channels,
  73.  *  Ch_struct has a pointer to an extension structure, called ch_phstruct.
  74.  *  The member is null for other channels.
  75.  */
  76.  
  77. /*      TELEPHONE-SPECIFIC PARAMETERS
  78.  *
  79.  *  The existing "telephone" channel also is used for low-speed hardwired
  80.  *  machine-machine exchange, through tty ports.
  81.  *
  82.  *  If a phone channel is inactive, by virtue of not having any mail going
  83.  *  from the local machine to the "other side", then we may need to poll
  84.  *  them, periodically, to see if they have any mail to be brought over.
  85.  *  Currently, you are limited to specifying a delay time; ch_poltime
  86.  *  indicates how many 15-minute units of time to wait, since the last
  87.  *  completed exchange, before polling.  NOTE:  you cannot currently
  88.  *  specify time-of-day / day-of-week windows.
  89.  *
  90.  *  In order to keep track of the channel's activity, the files _dstrt,
  91.  *  _ddone, and _pdone are used to note when outbound delivery was last
  92.  *  started, when it was last completed and when the last pickup (inbound
  93.  *  retrieval) was last completed.  The files are zero-length and only
  94.  *  their modification time is of interest.
  95.  *
  96.  *  Ch_access indicates that mail may be retrieved, as well as sent.
  97.  *
  98.  *  ch_script specifies the script file to be followed for creating a
  99.  *  connection to the slave on the other machine.  it usually indicates
  100.  *  what number to call or line to connect to, login sequence, and program
  101.  *  to start running.  it's use is more fully described in the dial
  102.  *  package's documentation.
  103.  */
  104. /* */
  105.  
  106. /*      DESCRIPTION OF OUTPUT CHANNELS
  107.  *
  108.  *  For active channels, an attempt is made to send queued mail.  For
  109.  *  passive channels, the mail is held until called for.  Some active
  110.  *  channels may be invoked by anyone, others are restricted to the Deliver
  111.  *  daemon (runnable an background).
  112.  *
  113.  *  A channel may have two "names".  One (ch_show) is intended for display
  114.  *  and may contain any characters that will enhance its presentation.
  115.  *  The other (ch_name) is intended for user input and more limited
  116.  *  display.  It should have no special characters (e.g., dash, space) and
  117.  *  should be entirely in lower case.  It must be unique.
  118.  *
  119.  *  A channel services a subset of the entire queue.  It access mail
  120.  *  stored under the sub-queue, specified by ch_queue.  More than one
  121.  *  channel may access a sub-queue, such as having an arpanet channel
  122.  *  and a backup phone channel.
  123.  *
  124.  *  Each channel has an associated table, with the names of hosts on that
  125.  *  channel.  The module, ch_table, handles access to the table and defines
  126.  *  its format.  The local host is usually named in the table.  In order to
  127.  *  capture references to the local machine, we need to know its "official"
  128.  *  name in the table.  ch_lname permits this.
  129.  *
  130.  *  ch_ldomain specifies the RFC822 domain name to use, for this host,
  131.  *  for the channel.
  132.  *
  133.  *  It also may allow some other special handling.  Usually, ch_lname is
  134.  *  the same as the global, locname[], but this is not required.  For
  135.  *  example, if there are several machines providing service to a single
  136.  *  organization, you may want ch_lname to be an internal, local-network
  137.  *  name for the local machine, while locname[] would be the public name
  138.  *  for the organization.
  139.  *
  140.  *  Channels often involve contact with a single, other host, which acts as
  141.  *  a relay for the other machines on a network.  If that is the case, then
  142.  *  the "official" name of that host should be specified (ch_host).  This is
  143.  *  particularly necessary when mail is picked up from (or submitted by)
  144.  *  the relay, so that the Via: field can cite it.
  145.  *
  146.  *  When the channel is passive and a single site acts as a relay for the
  147.  *  entire channel's mail, then there will be a single Unix login
  148.  *  authorized to perform the pickup.  That must be indicated with
  149.  *  ch_login.
  150.  *
  151.  *  If the channel is a telephone-like channel, then the above-described
  152.  *  ch_wait, ch_access, ch_login, must be filled in.
  153.  */
  154. /* */
  155.  
  156.  
  157. struct ch_struct
  158. {
  159.     char   *ch_name;              /* specification name of channel      */
  160.     char   *ch_show;              /* pretty-print name for display      */
  161.     Table  *ch_table;             /* pointer to host name table         */
  162.     char   *ch_queue;             /* 'channel' name to enter in queue   */
  163.     int     ch_access;            /* assorted switches                  */
  164. #define DLVRREG    00             /*   Active delivery, by any Deliver  */
  165. #define DLVRBAK    01             /*   Only runnable by daemon          */
  166. #define DLVRPSV    02             /*   Passive wait for pickup          */
  167. #define DLVRDID    04             /* (internal flag) chan was touched   */
  168.                   /*   a flag set by mmdf, sometimes    */
  169. #define DLVRIMM   010             /* may be run immediately (fast/cheap)*/
  170. #define CH_PICK   020             /*   ok to pickup mail                */
  171. #define CH_SEND   040             /*   ok to send mail                  */
  172. #define MQ_INQ   0100             /* queued under this channel          */
  173. #define DLVRHST  0200             /* Deliver in host order (MTR)        */
  174.     char   *ch_ppath;             /* path to file containing chan pgm   */
  175.     char   *ch_lname;             /* Official host name of local machine */
  176. #define DFLNAME     0             /* use locname as our name on chan    */
  177. #define NOLNAME    -1             /* we are not know on the channel (??)*/
  178.     char   *ch_ldomain;           /* Official domain name of this host  */
  179.     char   *ch_host;              /* name of host doing relay for chan  */
  180. #define NORELAY     0             /* direct receipt, rather than relay  */
  181.     char   *ch_login;             /* valid login name for pickup relay  */
  182.                   /*   ch_access must have PSV bit on   */
  183.                   /*   some PSV chans are direct recip- */
  184.                   /*   ients and not relays             */
  185. #define NOLOGIN     0             /* not a pickup channel               */
  186.     char    ch_poltime;           /* # of 15-minute periods to wait     */
  187. #define ALLPOLL -1                /*  -1 => poll on every wakeup        */
  188. #define NOPOLL   0                /*   0  => no polling allowed         */
  189.     char   *ch_trans;             /* filename of the phone transcript   */
  190.                   /* to use relative to logdfldir       */
  191. #define DEFTRANS 0                /*    0 => use the default trn file   */
  192.     char   *ch_script;            /* pathname to dialing script         */
  193. #define NOSCRIPT 0
  194.     Table  *ch_outsource;         /* list of sources authorized to      */
  195.                   /*   access this channel              */
  196.     Table  *ch_insource;          /* list of sources authorized to      */
  197.                   /*   access this channel              */
  198. #define NOFILTER 0
  199.     Table  *ch_outdest;           /* authorized destinations            */
  200.     Table  *ch_indest;            /* authorized destinations            */
  201.     Table  *ch_known;             /* table of hosts known to hosts on   *
  202.                    * this channel, normally == ch_table */
  203.  
  204.     char     *ch_confstr;        /* general purpose string              */
  205.     int      ch_apout;            /* default 733 / 822 /same format     */
  206.                   /* for header munging                 */
  207.     char     ch_auth;             /* For authorisation by user control  */
  208. #define CH_FREE        0
  209. #define CH_IN_LOG     01
  210. #define CH_IN_WARN    02
  211. #define CH_IN_BLOCK   04
  212. #define CH_OUT_LOG   010
  213. #define CH_OUT_WARN  020
  214. #define CH_OUT_BLOCK 040
  215. #define CH_HAU      0100        /* authorise on basis of host AND user */
  216. #define CH_DHO      0200
  217.  
  218. #define CH_IN_AUTH    07
  219. #define CH_OUT_AUTH  070
  220.     Cache   *ch_dead;           /* Current dead hosts */
  221.     time_t  ch_ttl;             /* Number of seconds to keep dead host records */
  222.     char    *ch_logfile;        /* Logfile for this channel */
  223.     int     ch_loglevel;        /* Logging level for this channel */
  224. };
  225.  
  226.  
  227. typedef struct ch_struct    Chan; /* make it a "type"                   */
  228.  
  229. Chan * ch_nm2struct (),           /* chan name -> ptr to its table entry */
  230.      * ch_qu2struct (),           /* queue name -> ptr to its table entry */
  231.      * ch_h2chan ();              /* use host name to find chan name     */
  232.  
  233. Chan   *ch_h2chan ();          /* which chan name table is host in?  */
  234.